package com.example.api.service;

import com.example.api.feign.UserFeign;
import com.example.common.Order;
import com.example.common.User;
import com.example.common.entity.ResultDO;
import com.example.common.entity.StatusCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @author meihua
 * @version 1.0
 * @date 2021/2/20 11:47
 */
@Service
public class OrderService {

    private static final Logger logger= LoggerFactory.getLogger(OrderService.class);

    @Resource
    private UserFeign userFeign;

    public Order queryOrder(Integer orderId){
        int i= 1 /orderId;

        logger.info("queryOrder :{}",orderId);
        System.out.println("queryOrder :"+orderId);
        User user = userFeign.getUserInfo(1005).getModel();
        return  new Order(orderId,"旺仔牛奶",new BigDecimal(6),"测试",user.getUserName(),1005);
    }
}
